#tag Class
Protected Class DownloadCURL
Inherits CURLMBS
	#tag Event
		Function Progress(dltotal as double, dlnow as double, ultotal as double, ulnow as double) As boolean
		  if _filesize <> -1 then
		    if _filesize=0 then
		      updateWin.StaticText3.text="Downloading..."
		      updatewin.ProgressBar1.Value = 0
		    end if
		    
		    if dlnow > 0 then
		      dim d as Double = dlnow/_filesize
		      dim p as integer = 100*d
		      if updateWin.ProgressBar1.Value<>p then
		        updateWin.ProgressBar1.Value=p
		      end if
		    end if
		    updateWin.ProgressBar1.Refresh
		    
		    updateWin.StaticText3.text="Downloading "+ str(Format(dlnow,"#")) +" of " + str(_filesize )  + " ("+ Format(dlnow/_filesize,"0%") +")"
		    updateWin.StaticText3.Refresh
		    updateWin.Refresh
		  end if
		  Return false
		  
		  
		End Function
	#tag EndEvent

	#tag Event
		Function Write(data as string) As integer
		  datas=Datas+data
		  
		  // System.DebugLog str(lenb(data))
		  
		  Return lenb(Data)
		End Function
	#tag EndEvent


	#tag Property, Flags = &h0
		datas As string
	#tag EndProperty


	#tag ViewBehavior
		#tag ViewProperty
			Name="Name"
			Visible=true
			Group="ID"
			InheritedFrom="CURLMBS"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Index"
			Visible=true
			Group="ID"
			InheritedFrom="CURLMBS"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Super"
			Visible=true
			Group="ID"
			InheritedFrom="CURLMBS"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Left"
			Visible=true
			Group="Position"
			InheritedFrom="CURLMBS"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Top"
			Visible=true
			Group="Position"
			InheritedFrom="CURLMBS"
		#tag EndViewProperty
		#tag ViewProperty
			Name="datas"
			Group="Behavior"
			Type="string"
			EditorType="MultiLineEditor"
		#tag EndViewProperty
	#tag EndViewBehavior
End Class
#tag EndClass
